
<!DOCTYPE HTML>
<html lang="zh-hans" >
<head>
    <meta charset="UTF-8">
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>2.5：调试Flutter APP · 《Flutter实战》</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="baidu-site-verification" content="Y34sAqDKUH"/>
    <meta name="theme-color" content="#ffffff">
    <!--<meta name="description" content="">-->
    <meta name="description" content="《Flutter实战》是Flutter中文网（https://flutterchina.club）开源的电子书，旨在帮助开发者系统化的了解并学习Flutter。">
    <meta name="keywords" content="flutter实战,flutter书籍,flutter电子书,flutter中文网 ">
    <meta name="generator" content="GitBook 3.2.3">
    
    <meta name="author" content="wendux 824783146@qq.com">
    
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/style.css">

    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-search-pro/search.css">
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-ace/ace.css">
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-splitter/splitter.css">
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-prism/prism.css">
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-donate/plugin.css">
    
    
    
    <link rel="stylesheet" href="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-fontsettings/website.css">
    
    
    

    

    
        
    
        
    
        
    
        
    
        
    

    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="https://pcdn.flutterchina.club/gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="https://pcdn.flutterchina.club/gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="thread_model_and_error_report.html" />
    
    
    <link rel="prev" href="flutter_assets_mgr.html" />
    

    <style>
        .pull-right > i {
            font-size: 25px;
            color: #777 !important;
            cursor: pointer;

        }

        .pull-right > i:hover {
            color: #777 !important;
        }

        body {
            font-size: 15px !important;
        }

        a[href='../todo.html'], a[href='todo.html'] {
            color: #888 !important;
        }

        .copyright {
            text-align: center;
            margin: 80px 16px 8px 16px;
            padding-top: 16px;
            border-top: #eee 1px solid;
            color: grey;
            font-size: .9em;
        }

        .f-links a{
            text-decoration: underline;
            color: dodgerblue !important;
        }

        .f-links a:hover{
            opacity: .8 !important;
        }

        /*.ad {*/
            /*color: white;*/
            /*text-align: center;*/
            /*background: url(https://img.alicdn.com/tfs/TB1Huu7vMmTBuNjy1XbXXaMrVXa-2880-400.png);*/
            /*background-size: cover;*/
            /*cursor: pointer;*/
            /*margin-bottom: 30px;*/
            /*padding: 18px*/
        /*}*/

        /*.ad:hover {*/
            /*opacity: .8;*/
        /*}*/

        .buy-btn {
            text-decoration: none !important;
            padding: 8px 18px;
            border: #268bd2 1px solid !important;
            display: inline-block !important;
            border-radius: 25px;
            color: #268bd2;
            margin-top: 10px;
        }

        .buy-btn:hover {
            transition: all ease 200ms;
            box-shadow: #555 2px 5px 10px;
            background: #eee;
            color: dodgerblue !important;
        }

        .maoyun{
            padding-top: 5px;
        }


    </style>
</head>
<body>
<!--<div id="ad" style="display: none">-->
<!--<div class="ad ad0"-->
<!--onclick="_track('aliyun','https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=8hhi4dts')">-->
<!--<div style="font-size: 1.3em; padding-right: 120px; position: relative; top: 12px">阿里云新春特惠</div>-->
<!--<div style="color:orange; font-size: 13px">限时红包 最高￥<span style="font-size: 40px">1888</span></div>-->
<!--</div>-->
<!--<div class="ad ad1"-->
<!--onclick="_track('aliyun-puhui','https://promotion.aliyun.com/ntms/act/qwbk.html?spm=5176.11533457.1089570.10.74e877e33jtaGy&userCode=8hhi4dts')">-->
<!--<div style="font-size: 1.5em;">阿里云全民云计算-新春特惠</div>-->
<!--<div style="color:orange; font-size: 18px;padding-top: 4px;">普惠上云，云服务器1核1G仅需293元/年</div>-->
<!--</div>-->
<!--</div>-->

<div class="ad"  style="text-align:center; padding-bottom:30px; display: none"><a href="https://item.jd.com/12816296.html" onclick="buy('img')" title='点击购买' target="_blank"><img style="height:250px;box-shadow: #aaa 5px 5px 10px;" src="https://pcdn.flutterchina.club/imgs/book.png"/></a>  <br/> <a class="buy-btn" onclick="buy('btn')" href="https://item.jd.com/12816296.html" title='点击购买' target="_blank"> 购买实体书 </a></div>


<!--<div class="ad"  style="text-align:center; padding-bottom:30px; display: none"><a href="https://item.jd.com/12816296.html" onclick="buy('img')" title='点击购买' target="_blank"><img style="height:250px;box-shadow: #aaa 5px 5px 10px;" src="https://pcdn.flutterchina.club/imgs/book.png"/></a>  <br/> <a class="buy-btn" onclick="buy('img')" href="https://item.jd.com/12816296.html" title='点击购买' target="_blank"> 购买实体书 </a>-->
    <!--<a id="jd" href="https://item.jd.com/12816296.html" onclick="buy('jd')"  style=" display: block; padding: 10px; color: red; text-decoration: underline; ">即日起至4.23日，京东图书每满100减50！ </a>-->
<!--</div>-->


<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://flutterchina.club" target="_blank" class="custom-link"><div><img height=20 style='position:relative; top:5px; padding-right:5px ' src='https://cdn.jsdelivr.net/gh/flutterchina/website@1.0/images/favicon.png'/> Flutter中文网</div></a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../intro.html">
            
                <a href="../intro.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">入门篇</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../chapter1/">
            
                <a href="../chapter1/">
            
                    
                    第一章：起步
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../chapter1/mobile_development_intro.html">
            
                <a href="../chapter1/mobile_development_intro.html">
            
                    
                    1.1：移动开发技术简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../chapter1/flutter_intro.html">
            
                <a href="../chapter1/flutter_intro.html">
            
                    
                    1.2：初识Flutter
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../chapter1/install_flutter.html">
            
                <a href="../chapter1/install_flutter.html">
            
                    
                    1.3：搭建Flutter开发环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../chapter1/dart.html">
            
                <a href="../chapter1/dart.html">
            
                    
                    1.4：Dart语言简介
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="./">
            
                <a href="./">
            
                    
                    第二章：第一个Flutter应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="first_flutter_app.html">
            
                <a href="first_flutter_app.html">
            
                    
                    2.1：计数器示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="flutter_router.html">
            
                <a href="flutter_router.html">
            
                    
                    2.2：路由管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="flutter_package_mgr.html">
            
                <a href="flutter_package_mgr.html">
            
                    
                    2.3：包管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.4" data-path="flutter_assets_mgr.html">
            
                <a href="flutter_assets_mgr.html">
            
                    
                    2.4：资源管理
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.2.5" data-path="flutter_app_debug.html">
            
                <a href="flutter_app_debug.html">
            
                    
                    2.5：调试Flutter APP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.6" data-path="thread_model_and_error_report.html">
            
                <a href="thread_model_and_error_report.html">
            
                    
                    2.6：Dart线程模型及异常捕获
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="../chapter3/">
            
                <a href="../chapter3/">
            
                    
                    第三章：基础组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../chapter3/flutter_widget_intro.html">
            
                <a href="../chapter3/flutter_widget_intro.html">
            
                    
                    3.1：Widget简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../chapter3/state_manage.html">
            
                <a href="../chapter3/state_manage.html">
            
                    
                    3.2：状态管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="../chapter3/text.html">
            
                <a href="../chapter3/text.html">
            
                    
                    3.3：文本、字体样式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="../chapter3/buttons.html">
            
                <a href="../chapter3/buttons.html">
            
                    
                    3.4：按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="../chapter3/img_and_icon.html">
            
                <a href="../chapter3/img_and_icon.html">
            
                    
                    3.5：图片和Icon
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="../chapter3/radio_and_checkbox.html">
            
                <a href="../chapter3/radio_and_checkbox.html">
            
                    
                    3.6：单选框和复选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="../chapter3/input_and_form.html">
            
                <a href="../chapter3/input_and_form.html">
            
                    
                    3.7：输入框和表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="../chapter3/progress.html">
            
                <a href="../chapter3/progress.html">
            
                    
                    3.8：进度指示器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../chapter4/">
            
                <a href="../chapter4/">
            
                    
                    第四章：布局类组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../chapter4/intro.html">
            
                <a href="../chapter4/intro.html">
            
                    
                    4.1：布局类组件简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../chapter4/row_and_column.html">
            
                <a href="../chapter4/row_and_column.html">
            
                    
                    4.2：线性布局（Row、Column）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../chapter4/flex.html">
            
                <a href="../chapter4/flex.html">
            
                    
                    4.3：弹性布局（Flex）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.4" data-path="../chapter4/wrap_and_flow.html">
            
                <a href="../chapter4/wrap_and_flow.html">
            
                    
                    4.4：流式布局（Wrap、Flow）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.5" data-path="../chapter4/stack.html">
            
                <a href="../chapter4/stack.html">
            
                    
                    4.5：层叠布局（Stack、Positioned）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.6" data-path="../chapter4/alignment.html">
            
                <a href="../chapter4/alignment.html">
            
                    
                    4.6：对齐与相对定位（Align）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../chapter5/">
            
                <a href="../chapter5/">
            
                    
                    第五章：容器类组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../chapter5/padding.html">
            
                <a href="../chapter5/padding.html">
            
                    
                    5.1：填充（Padding）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="../chapter5/constrainedbox_and_sizebox.html">
            
                <a href="../chapter5/constrainedbox_and_sizebox.html">
            
                    
                    5.2：尺寸限制类容器（ConstrainedBox等）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.3" data-path="../chapter5/decoratedbox.html">
            
                <a href="../chapter5/decoratedbox.html">
            
                    
                    5.3：装饰容器（DecoratedBox）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.4" data-path="../chapter5/transform.html">
            
                <a href="../chapter5/transform.html">
            
                    
                    5.4：变换（Transform）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.5" data-path="../chapter5/container.html">
            
                <a href="../chapter5/container.html">
            
                    
                    5.5：Container容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.6" data-path="../chapter5/material_scaffold.html">
            
                <a href="../chapter5/material_scaffold.html">
            
                    
                    5.6：Scaffold、TabBar、底部导航
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.7" data-path="../chapter5/clip.html">
            
                <a href="../chapter5/clip.html">
            
                    
                    5.7：剪裁（Clip）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../chapter6/">
            
                <a href="../chapter6/">
            
                    
                    第六章：可滚动组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../chapter6/intro.html">
            
                <a href="../chapter6/intro.html">
            
                    
                    6.1：可滚动组件简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../chapter6/single_child_scrollview.html">
            
                <a href="../chapter6/single_child_scrollview.html">
            
                    
                    6.2：SingleChildScrollView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../chapter6/listview.html">
            
                <a href="../chapter6/listview.html">
            
                    
                    6.3：ListView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../chapter6/gridview.html">
            
                <a href="../chapter6/gridview.html">
            
                    
                    6.4：GridView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="../chapter6/custom_scrollview.html">
            
                <a href="../chapter6/custom_scrollview.html">
            
                    
                    6.5：CustomScrollView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="../chapter6/scroll_controller.html">
            
                <a href="../chapter6/scroll_controller.html">
            
                    
                    6.6：滚动监听及控制（ScrollController）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../chapter7/">
            
                <a href="../chapter7/">
            
                    
                    第七章：功能型组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="../chapter7/willpopscope.html">
            
                <a href="../chapter7/willpopscope.html">
            
                    
                    7.1：导航返回拦截（WillPopScope）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="../chapter7/inherited_widget.html">
            
                <a href="../chapter7/inherited_widget.html">
            
                    
                    7.2：数据共享（InheritedWidget）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.3" data-path="../chapter7/provider.html">
            
                <a href="../chapter7/provider.html">
            
                    
                    7.3： 跨组件状态共享（Provider）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.4" data-path="../chapter7/theme.html">
            
                <a href="../chapter7/theme.html">
            
                    
                    7.4：颜色和主题（Theme）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.5" data-path="../chapter7/futurebuilder_and_streambuilder.html">
            
                <a href="../chapter7/futurebuilder_and_streambuilder.html">
            
                    
                    7.5：异步UI更新（FutureBuilder、StreamBuilder）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.6" data-path="../chapter7/dailog.html">
            
                <a href="../chapter7/dailog.html">
            
                    
                    7.6：对话框详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">进阶篇</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../chapter8/">
            
                <a href="../chapter8/">
            
                    
                    第八章：事件处理与通知
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../chapter8/listener.html">
            
                <a href="../chapter8/listener.html">
            
                    
                    8.1：原始指针事件处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../chapter8/gesture.html">
            
                <a href="../chapter8/gesture.html">
            
                    
                    8.2：手势识别
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../chapter8/eventbus.html">
            
                <a href="../chapter8/eventbus.html">
            
                    
                    8.3：全局事件总线
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../chapter8/notification.html">
            
                <a href="../chapter8/notification.html">
            
                    
                    8.4：通知(Notification)
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../chapter9/">
            
                <a href="../chapter9/">
            
                    
                    第九章：动画
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../chapter9/intro.html">
            
                <a href="../chapter9/intro.html">
            
                    
                    9.1：Flutter动画简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../chapter9/animation_structure.html">
            
                <a href="../chapter9/animation_structure.html">
            
                    
                    9.2：动画结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="../chapter9/route_transition.html">
            
                <a href="../chapter9/route_transition.html">
            
                    
                    9.3：自定义路由过渡动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="../chapter9/hero.html">
            
                <a href="../chapter9/hero.html">
            
                    
                    9.4：Hero动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="../chapter9/stagger_animation.html">
            
                <a href="../chapter9/stagger_animation.html">
            
                    
                    9.5：交织动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="../chapter9/animated_switcher.html">
            
                <a href="../chapter9/animated_switcher.html">
            
                    
                    9.6：通用“动画切换”组件（AnimatedSwitcher）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.7" data-path="../chapter9/animated_widgets.html">
            
                <a href="../chapter9/animated_widgets.html">
            
                    
                    9.7：动画过渡组件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="../chapter10/">
            
                <a href="../chapter10/">
            
                    
                    第十章：自定义组件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="../chapter10/intro.html">
            
                <a href="../chapter10/intro.html">
            
                    
                    10.1：自定义组件方法简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="../chapter10/combine.html">
            
                <a href="../chapter10/combine.html">
            
                    
                    10.2：组合现有组件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="../chapter10/turn_box.html">
            
                <a href="../chapter10/turn_box.html">
            
                    
                    10.3：组合实例：TurnBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="../chapter10/custom_paint.html">
            
                <a href="../chapter10/custom_paint.html">
            
                    
                    10.4：自绘组件（CustomPaint与Canvas）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="../chapter10/gradient_circular_progress_demo.html">
            
                <a href="../chapter10/gradient_circular_progress_demo.html">
            
                    
                    10.5：自绘实例：圆形渐变进度条(自绘)
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../chapter11/">
            
                <a href="../chapter11/">
            
                    
                    第十一章：文件操作与网络请求
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="../chapter11/file_operation.html">
            
                <a href="../chapter11/file_operation.html">
            
                    
                    11.1：文件操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="../chapter11/http.html">
            
                <a href="../chapter11/http.html">
            
                    
                    11.2：Http请求-HttpClient
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3" data-path="../chapter11/dio.html">
            
                <a href="../chapter11/dio.html">
            
                    
                    11.3：Http请求-Dio package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.4" data-path="../chapter11/download_with_chunks.html">
            
                <a href="../chapter11/download_with_chunks.html">
            
                    
                    11.4：实例：Http分块下载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.5" data-path="../chapter11/websocket.html">
            
                <a href="../chapter11/websocket.html">
            
                    
                    11.5：WebSocket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.6" data-path="../chapter11/socket.html">
            
                <a href="../chapter11/socket.html">
            
                    
                    11.6：使用Socket API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.7" data-path="../chapter11/json_model.html">
            
                <a href="../chapter11/json_model.html">
            
                    
                    11.7：Json转Dart Model类
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../chapter12/">
            
                <a href="../chapter12/">
            
                    
                    第十二章：包与插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../chapter12/develop_package.html">
            
                <a href="../chapter12/develop_package.html">
            
                    
                    12.1：开发package
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" data-path="../chapter12/platform-channel.html">
            
                <a href="../chapter12/platform-channel.html">
            
                    
                    12.2：平台通道简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="../chapter12/develop_plugin.html">
            
                <a href="../chapter12/develop_plugin.html">
            
                    
                    12.3：开发Flutter插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.4" data-path="../chapter12/android_implement.html">
            
                <a href="../chapter12/android_implement.html">
            
                    
                    12.4：插件开发：实现Android端API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.5" data-path="../chapter12/ios_implement.html">
            
                <a href="../chapter12/ios_implement.html">
            
                    
                    12.5：插件开发：实现IOS端API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.6" data-path="../chapter12/texture_platformview.html">
            
                <a href="../chapter12/texture_platformview.html">
            
                    
                    12.6：Texture和PlatformView
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../chapter13/">
            
                <a href="../chapter13/">
            
                    
                    第十三章：国际化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="../chapter13/multi_languages_support.html">
            
                <a href="../chapter13/multi_languages_support.html">
            
                    
                    13.1：让App支持多语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.2" data-path="../chapter13/locallization_implement.html">
            
                <a href="../chapter13/locallization_implement.html">
            
                    
                    13.2：实现Localizations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.3" data-path="../chapter13/intl.html">
            
                <a href="../chapter13/intl.html">
            
                    
                    13.3：使用Intl包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.4" data-path="../chapter13/faq.html">
            
                <a href="../chapter13/faq.html">
            
                    
                    13.4：国际化常见问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../chapter14/">
            
                <a href="../chapter14/">
            
                    
                    第十四章：Flutter核心原理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="../chapter14/flutter_ui_system.html">
            
                <a href="../chapter14/flutter_ui_system.html">
            
                    
                    14.1：Flutter UI系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="../chapter14/element_buildcontext.html">
            
                <a href="../chapter14/element_buildcontext.html">
            
                    
                    14.2：Element和BuildContext
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.3" data-path="../chapter14/render_object.html">
            
                <a href="../chapter14/render_object.html">
            
                    
                    14.3：RenderObject与RenderBox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.4" data-path="../chapter14/flutter_app_startup.html">
            
                <a href="../chapter14/flutter_app_startup.html">
            
                    
                    14.4：Flutter从启动到显示
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.5" data-path="../chapter14/image_and_cache.html">
            
                <a href="../chapter14/image_and_cache.html">
            
                    
                    14.5：Flutter图片加载与缓存
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">实例篇</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../chapter15/intro.html">
            
                <a href="../chapter15/intro.html">
            
                    
                    第十五章：一个完整的Flutter应用
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../chapter15/intro.html">
            
                <a href="../chapter15/intro.html">
            
                    
                    15.1：应用简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../chapter15/code_structure.html">
            
                <a href="../chapter15/code_structure.html">
            
                    
                    15.2：APP代码结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.3" data-path="../chapter15/models.html">
            
                <a href="../chapter15/models.html">
            
                    
                    15.3：Model类定义
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.4" data-path="../chapter15/globals.html">
            
                <a href="../chapter15/globals.html">
            
                    
                    15.4：全局变量及共享状态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.5" data-path="../chapter15/network.html">
            
                <a href="../chapter15/network.html">
            
                    
                    15.5：网络请求封装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.6" data-path="../chapter15/entry.html">
            
                <a href="../chapter15/entry.html">
            
                    
                    15.6：App入口及首页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.7" data-path="../chapter15/login_page.html">
            
                <a href="../chapter15/login_page.html">
            
                    
                    15.7：登录页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.8" data-path="../chapter15/language_and_theme_setting.html">
            
                <a href="../chapter15/language_and_theme_setting.html">
            
                    
                    15.8：多语言和多主题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="https://pcdn.flutterchina.club/gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    
    <a class="btn pull-right" aria-label="GitHub">
        <i class="fa fa-edit" title="编辑本文"></i>
    </a>
    <a class="btn pull-right" aria-label="GitHub" href="https://github.com/flutterchina/flutter-in-action">
        <i class="fa fa-github" title="查看本书开源项目"></i>
    </a>
    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >2.5：调试Flutter APP</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="25-&#x8C03;&#x8BD5;flutter&#x5E94;&#x7528;">2.5 &#x8C03;&#x8BD5;Flutter&#x5E94;&#x7528;</h1>
<p>&#x6709;&#x5404;&#x79CD;&#x5404;&#x6837;&#x7684;&#x5DE5;&#x5177;&#x548C;&#x529F;&#x80FD;&#x6765;&#x5E2E;&#x52A9;&#x8C03;&#x8BD5;Flutter&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<h3 id="dart-&#x5206;&#x6790;&#x5668;">Dart &#x5206;&#x6790;&#x5668;</h3>
<p>&#x5728;&#x8FD0;&#x884C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x524D;&#xFF0C;&#x8BF7;&#x8FD0;&#x884C;<code>flutter analyze</code>&#x6D4B;&#x8BD5;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#x3002;&#x8FD9;&#x4E2A;&#x5DE5;&#x5177;&#x662F;&#x4E00;&#x4E2A;&#x9759;&#x6001;&#x4EE3;&#x7801;&#x68C0;&#x67E5;&#x5DE5;&#x5177;&#xFF0C;&#x5B83;&#x662F;<code>dartanalyzer</code>&#x5DE5;&#x5177;&#x7684;&#x4E00;&#x4E2A;&#x5305;&#x88C5;&#xFF0C;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x5206;&#x6790;&#x4EE3;&#x7801;&#x5E76;&#x5E2E;&#x52A9;&#x5F00;&#x53D1;&#x8005;&#x53D1;&#x73B0;&#x53EF;&#x80FD;&#x7684;&#x9519;&#x8BEF;&#xFF0C;&#x6BD4;&#x5982;&#xFF0C;Dart&#x5206;&#x6790;&#x5668;&#x5927;&#x91CF;&#x4F7F;&#x7528;&#x4E86;&#x4EE3;&#x7801;&#x4E2D;&#x7684;&#x7C7B;&#x578B;&#x6CE8;&#x91CA;&#x6765;&#x5E2E;&#x52A9;&#x8FFD;&#x8E2A;&#x95EE;&#x9898;&#xFF0C;&#x907F;&#x514D;<code>var</code>&#x3001;&#x65E0;&#x7C7B;&#x578B;&#x7684;&#x53C2;&#x6570;&#x3001;&#x65E0;&#x7C7B;&#x578B;&#x7684;&#x5217;&#x8868;&#x6587;&#x5B57;&#x7B49;&#x3002;</p>
<p> &#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528;IntelliJ&#x7684;Flutter&#x63D2;&#x4EF6;&#xFF0C;&#x90A3;&#x4E48;&#x5206;&#x6790;&#x5668;&#x5728;&#x6253;&#x5F00;IDE&#x65F6;&#x5C31;&#x5DF2;&#x7ECF;&#x81EA;&#x52A8;&#x542F;&#x7528;&#x4E86;&#xFF0C;&#x5982;&#x679C;&#x8BFB;&#x8005;&#x4F7F;&#x7528;&#x7684;&#x662F;&#x5176;&#x5B83;IDE&#xFF0C;&#x5F3A;&#x70C8;&#x5EFA;&#x8BAE;&#x8BFB;&#x8005;&#x542F;&#x7528;Dart &#x5206;&#x6790;&#x5668;&#xFF0C;&#x56E0;&#x4E3A;&#x5728;&#x5927;&#x591A;&#x6570;&#x65F6;&#x5019;&#xFF0C;Dart &#x5206;&#x6790;&#x5668;&#x53EF;&#x4EE5;&#x5728;&#x4EE3;&#x7801;&#x8FD0;&#x884C;&#x524D;&#x53D1;&#x73B0;&#x5927;&#x591A;&#x6570;&#x95EE;&#x9898;&#x3002;</p>
<h3 id="dart-observatory-&#x8BED;&#x53E5;&#x7EA7;&#x7684;&#x5355;&#x6B65;&#x8C03;&#x8BD5;&#x548C;&#x5206;&#x6790;&#x5668;">Dart Observatory (&#x8BED;&#x53E5;&#x7EA7;&#x7684;&#x5355;&#x6B65;&#x8C03;&#x8BD5;&#x548C;&#x5206;&#x6790;&#x5668;)</h3>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x4F7F;&#x7528;<code>flutter run</code>&#x542F;&#x52A8;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;&#x90A3;&#x4E48;&#x5F53;&#x5B83;&#x8FD0;&#x884C;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x6253;&#x5F00;Observatory&#x5DE5;&#x5177;&#x7684;Web&#x9875;&#x9762;&#xFF0C;&#x4F8B;&#x5982;Observatory&#x9ED8;&#x8BA4;&#x76D1;&#x542C;<a href="http://127.0.0.1:8100/" target="_blank">http://127.0.0.1:8100/</a>&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x76F4;&#x63A5;&#x6253;&#x5F00;&#x8BE5;&#x94FE;&#x63A5;&#x3002;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x8BED;&#x53E5;&#x7EA7;&#x5355;&#x6B65;&#x8C03;&#x8BD5;&#x5668;&#x8FDE;&#x63A5;&#x5230;&#x60A8;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;&#x5982;&#x679C;&#x60A8;&#x4F7F;&#x7528;&#x7684;&#x662F;IntelliJ&#xFF0C;&#x5219;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5176;&#x5185;&#x7F6E;&#x7684;&#x8C03;&#x8BD5;&#x5668;&#x6765;&#x8C03;&#x8BD5;&#x60A8;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<p>Observatory &#x540C;&#x65F6;&#x652F;&#x6301;&#x5206;&#x6790;&#x3001;&#x68C0;&#x67E5;&#x5806;&#x7B49;&#x3002;&#x6709;&#x5173;Observatory&#x7684;&#x66F4;&#x591A;&#x4FE1;&#x606F;&#x8BF7;&#x53C2;&#x8003;<a href="https://dart-lang.github.io/observatory/" target="_blank">Observatory &#x6587;&#x6863;</a>&#x3002;</p>
<p>&#x5982;&#x679C;&#x60A8;&#x4F7F;&#x7528;Observatory&#x8FDB;&#x884C;&#x5206;&#x6790;&#xFF0C;&#x8BF7;&#x786E;&#x4FDD;&#x901A;&#x8FC7;<code>--profile</code>&#x9009;&#x9879;&#x6765;&#x8FD0;&#x884C;<code>flutter run</code>&#x547D;&#x4EE4;&#x6765;&#x8FD0;&#x884C;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002; &#x5426;&#x5219;&#xFF0C;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x4E2D;&#x5C06;&#x51FA;&#x73B0;&#x7684;&#x4E3B;&#x8981;&#x95EE;&#x9898;&#x5C06;&#x662F;&#x8C03;&#x8BD5;&#x65AD;&#x8A00;&#xFF0C;&#x4EE5;&#x9A8C;&#x8BC1;&#x6846;&#x67B6;&#x7684;&#x5404;&#x79CD;&#x4E0D;&#x53D8;&#x91CF;&#xFF08;&#x8BF7;&#x53C2;&#x9605;&#x4E0B;&#x9762;&#x7684;&#x201C;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x65AD;&#x8A00;&#x201D;&#xFF09;&#x3002;</p>
<h3 id="debugger-&#x58F0;&#x660E;"><code>debugger()</code> &#x58F0;&#x660E;</h3>
<p>&#x5F53;&#x4F7F;&#x7528;Dart Observatory&#xFF08;&#x6216;&#x53E6;&#x4E00;&#x4E2A;Dart&#x8C03;&#x8BD5;&#x5668;&#xFF0C;&#x4F8B;&#x5982;IntelliJ IDE&#x4E2D;&#x7684;&#x8C03;&#x8BD5;&#x5668;&#xFF09;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8BE5;<code>debugger()</code>&#x8BED;&#x53E5;&#x63D2;&#x5165;&#x7F16;&#x7A0B;&#x5F0F;&#x65AD;&#x70B9;&#x3002;&#x8981;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;&#xFF0C;&#x4F60;&#x5FC5;&#x987B;&#x6DFB;&#x52A0;<code>import &apos;dart:developer&apos;;</code>&#x5230;&#x76F8;&#x5173;&#x6587;&#x4EF6;&#x9876;&#x90E8;&#x3002;</p>
<p><code>debugger()</code>&#x8BED;&#x53E5;&#x91C7;&#x7528;&#x4E00;&#x4E2A;&#x53EF;&#x9009;<code>when</code>&#x53C2;&#x6570;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x8BE5;&#x53C2;&#x6570;&#x4EC5;&#x5728;&#x7279;&#x5B9A;&#x6761;&#x4EF6;&#x4E3A;&#x771F;&#x65F6;&#x4E2D;&#x65AD;&#xFF0C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">void</span> <span class="token function">someFunction</span><span class="token punctuation">(</span>double offset<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token function">debugger</span><span class="token punctuation">(</span>when<span class="token punctuation">:</span> offset <span class="token operator">&gt;</span> <span class="token number">30.0</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token comment">// ...</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="print&#x3001;debugprint&#x3001;flutter-logs"><code>print</code>&#x3001;<code>debugPrint</code>&#x3001;<code>flutter logs</code></h3>
<p>Dart <code>print()</code>&#x529F;&#x80FD;&#x5C06;&#x8F93;&#x51FA;&#x5230;&#x7CFB;&#x7EDF;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>flutter logs</code>&#x6765;&#x67E5;&#x770B;&#x5B83;&#xFF08;&#x57FA;&#x672C;&#x4E0A;&#x662F;&#x4E00;&#x4E2A;&#x5305;&#x88C5;<code>adb logcat</code>&#xFF09;&#x3002;</p>
<p>&#x5982;&#x679C;&#x4F60;&#x4E00;&#x6B21;&#x8F93;&#x51FA;&#x592A;&#x591A;&#xFF0C;&#x90A3;&#x4E48;Android&#x6709;&#x65F6;&#x4F1A;&#x4E22;&#x5F03;&#x4E00;&#x4E9B;&#x65E5;&#x5FD7;&#x884C;&#x3002;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;Flutter&#x7684;<code>foundation</code>&#x5E93;&#x4E2D;&#x7684;<a href="https://docs.flutter.io/flutter/foundation/debugPrint.html" target="_blank"><code>debugPrint()</code></a>&#x3002; &#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x5C01;&#x88C5;print&#xFF0C;&#x5B83;&#x5C06;&#x8F93;&#x51FA;&#x9650;&#x5236;&#x5728;&#x4E00;&#x4E2A;&#x7EA7;&#x522B;&#xFF0C;&#x907F;&#x514D;&#x88AB;Android&#x5185;&#x6838;&#x4E22;&#x5F03;&#x3002;</p>
<p>Flutter&#x6846;&#x67B6;&#x4E2D;&#x7684;&#x8BB8;&#x591A;&#x7C7B;&#x90FD;&#x6709;<code>toString</code>&#x5B9E;&#x73B0;&#x3002;&#x6309;&#x7167;&#x60EF;&#x4F8B;&#xFF0C;&#x8FD9;&#x4E9B;&#x8F93;&#x51FA;&#x901A;&#x5E38;&#x5305;&#x62EC;&#x5BF9;&#x8C61;&#x7684;<code>runtimeType</code>&#x5355;&#x884C;&#x8F93;&#x51FA;&#xFF0C;&#x901A;&#x5E38;&#x5728;&#x8868;&#x5355;&#x4E2D;ClassName(more information about this instance&#x2026;)&#x3002; &#x6811;&#x4E2D;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B;&#x7C7B;&#x4E5F;&#x5177;&#x6709;<code>toStringDeep</code>&#xFF0C;&#x4ECE;&#x8BE5;&#x70B9;&#x8FD4;&#x56DE;&#x6574;&#x4E2A;&#x5B50;&#x6811;&#x7684;&#x591A;&#x884C;&#x63CF;&#x8FF0;&#x3002;&#x5DF2;&#x4E00;&#x4E9B;&#x5177;&#x6709;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;<code>toString</code>&#x7684;&#x7C7B;&#x4F1A;&#x5B9E;&#x73B0;&#x4E00;&#x4E2A;<code>toStringShort</code>&#xFF0C;&#x5B83;&#x53EA;&#x8FD4;&#x56DE;&#x5BF9;&#x8C61;&#x7684;&#x7C7B;&#x578B;&#x6216;&#x5176;&#x4ED6;&#x975E;&#x5E38;&#x7B80;&#x77ED;&#x7684;&#xFF08;&#x4E00;&#x4E2A;&#x6216;&#x4E24;&#x4E2A;&#x5355;&#x8BCD;&#xFF09;&#x63CF;&#x8FF0;&#x3002;</p>
<h3 id="&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x65AD;&#x8A00;">&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x65AD;&#x8A00;</h3>
<p>&#x5728;Flutter&#x5E94;&#x7528;&#x8C03;&#x8BD5;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;Dart <code>assert</code>&#x8BED;&#x53E5;&#x88AB;&#x542F;&#x7528;&#xFF0C;&#x5E76;&#x4E14;Flutter&#x6846;&#x67B6;&#x4F7F;&#x7528;&#x5B83;&#x6765;&#x6267;&#x884C;&#x8BB8;&#x591A;&#x8FD0;&#x884C;&#x65F6;&#x68C0;&#x67E5;&#x6765;&#x9A8C;&#x8BC1;&#x662F;&#x5426;&#x8FDD;&#x53CD;&#x4E00;&#x4E9B;&#x4E0D;&#x53EF;&#x53D8;&#x7684;&#x89C4;&#x5219;&#x3002;</p>
<p>&#x5F53;&#x4E00;&#x4E2A;&#x4E0D;&#x53EF;&#x53D8;&#x7684;&#x89C4;&#x5219;&#x88AB;&#x8FDD;&#x53CD;&#x65F6;&#xFF0C;&#x5B83;&#x88AB;&#x62A5;&#x544A;&#x7ED9;&#x63A7;&#x5236;&#x53F0;&#xFF0C;&#x5E76;&#x5E26;&#x6709;&#x4E00;&#x4E9B;&#x4E0A;&#x4E0B;&#x6587;&#x4FE1;&#x606F;&#x6765;&#x5E2E;&#x52A9;&#x8FFD;&#x8E2A;&#x95EE;&#x9898;&#x7684;&#x6839;&#x6E90;&#x3002;</p>
<p>&#x8981;&#x5173;&#x95ED;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x5E76;&#x4F7F;&#x7528;&#x53D1;&#x5E03;&#x6A21;&#x5F0F;&#xFF0C;&#x8BF7;&#x4F7F;&#x7528;<code>flutter run --release</code>&#x8FD0;&#x884C;&#x60A8;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002; &#x8FD9;&#x4E5F;&#x5173;&#x95ED;&#x4E86;Observatory&#x8C03;&#x8BD5;&#x5668;&#x3002;&#x4E00;&#x4E2A;&#x4E2D;&#x95F4;&#x6A21;&#x5F0F;&#x53EF;&#x4EE5;&#x5173;&#x95ED;&#x9664;Observatory&#x4E4B;&#x5916;&#x6240;&#x6709;&#x8C03;&#x8BD5;&#x8F85;&#x52A9;&#x5DE5;&#x5177;&#x7684;&#xFF0C;&#x79F0;&#x4E3A;&#x201C;profile mode&#x201D;&#xFF0C;&#x7528;<code>--profile</code>&#x66FF;&#x4EE3;<code>--release</code>&#x5373;&#x53EF;&#x3002;</p>
<h3 id="&#x8C03;&#x8BD5;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5C42;">&#x8C03;&#x8BD5;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5C42;</h3>
<p>Flutter&#x6846;&#x67B6;&#x7684;&#x6BCF;&#x4E00;&#x5C42;&#x90FD;&#x63D0;&#x4F9B;&#x4E86;&#x5C06;&#x5176;&#x5F53;&#x524D;&#x72B6;&#x6001;&#x6216;&#x4E8B;&#x4EF6;&#x8F6C;&#x50A8;(dump)&#x5230;&#x63A7;&#x5236;&#x53F0;&#xFF08;&#x4F7F;&#x7528;<code>debugPrint</code>&#xFF09;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
<h4 id="widget-&#x6811;">Widget &#x6811;</h4>
<p>&#x8981;&#x8F6C;&#x50A8;Widgets&#x6811;&#x7684;&#x72B6;&#x6001;&#xFF0C;&#x8BF7;&#x8C03;&#x7528;<a href="https://docs.flutter.io/flutter/widgets/debugDumpApp.html" target="_blank"><code>debugDumpApp()</code></a>&#x3002; &#x53EA;&#x8981;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5DF2;&#x7ECF;&#x6784;&#x5EFA;&#x4E86;&#x81F3;&#x5C11;&#x4E00;&#x6B21;&#xFF08;&#x5373;&#x5728;&#x8C03;&#x7528;<code>build()</code>&#x4E4B;&#x540E;&#x7684;&#x4EFB;&#x4F55;&#x65F6;&#x95F4;&#xFF09;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x672A;&#x5904;&#x4E8E;&#x6784;&#x5EFA;&#x9636;&#x6BB5;&#xFF08;&#x5373;&#xFF0C;&#x4E0D;&#x5728;<code>build()</code>&#x65B9;&#x6CD5;&#x5185;&#x8C03;&#x7528; &#xFF09;&#x7684;&#x4EFB;&#x4F55;&#x65F6;&#x95F4;&#x8C03;&#x7528;&#x6B64;&#x65B9;&#x6CD5;&#xFF08;&#x5728;&#x8C03;&#x7528;<code>runApp()</code>&#x4E4B;&#x540E;&#xFF09;&#x3002;</p>
<p>&#x5982;, &#x8FD9;&#x4E2A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;:</p>
<pre class="language-"><code class="lang-dart"><span class="token keyword">import</span> <span class="token string">&apos;package:flutter/material.dart&apos;</span><span class="token punctuation">;</span>

<span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token function">runApp</span><span class="token punctuation">(</span>
    <span class="token keyword">new</span> <span class="token class-name">MaterialApp</span><span class="token punctuation">(</span>
      home<span class="token punctuation">:</span> <span class="token keyword">new</span> <span class="token class-name">AppHome</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token punctuation">)</span><span class="token punctuation">,</span>
  <span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">class</span> <span class="token class-name">AppHome</span> <span class="token keyword">extends</span> <span class="token class-name">StatelessWidget</span> <span class="token punctuation">{</span>
  <span class="token metadata symbol">@override</span>
  Widget <span class="token function">build</span><span class="token punctuation">(</span>BuildContext context<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token keyword">new</span> <span class="token class-name">Material</span><span class="token punctuation">(</span>
      child<span class="token punctuation">:</span> <span class="token keyword">new</span> <span class="token class-name">Center</span><span class="token punctuation">(</span>
        child<span class="token punctuation">:</span> <span class="token keyword">new</span> <span class="token class-name">FlatButton</span><span class="token punctuation">(</span>
          onPressed<span class="token punctuation">:</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token function">debugDumpApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
          <span class="token punctuation">}</span><span class="token punctuation">,</span>
          child<span class="token punctuation">:</span> <span class="token keyword">new</span> <span class="token class-name">Text</span><span class="token punctuation">(</span><span class="token string">&apos;Dump App&apos;</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
        <span class="token punctuation">)</span><span class="token punctuation">,</span>
      <span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre>
<p>&#x2026;&#x4F1A;&#x8F93;&#x51FA;&#x8FD9;&#x6837;&#x7684;&#x5185;&#x5BB9;&#xFF08;&#x7CBE;&#x786E;&#x7684;&#x7EC6;&#x8282;&#x4F1A;&#x6839;&#x636E;&#x6846;&#x67B6;&#x7684;&#x7248;&#x672C;&#x3001;&#x8BBE;&#x5907;&#x7684;&#x5927;&#x5C0F;&#x7B49;&#x7B49;&#x800C;&#x53D8;&#x5316;&#xFF09;&#xFF1A;</p>
<pre class="language-"><code class="lang-shell">I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>: WidgetsFlutterBinding - CHECKED MODE
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>: RenderObjectToWidgetAdapter<span class="token operator">&lt;</span>RenderBox<span class="token operator">&gt;</span><span class="token punctuation">(</span><span class="token punctuation">[</span>GlobalObjectKey RenderView<span class="token punctuation">(</span><span class="token number">497039273</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">;</span> renderObject: RenderView<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>: &#x2514;MaterialApp<span class="token punctuation">(</span>state: _MaterialAppState<span class="token punctuation">(</span><span class="token number">1009803148</span><span class="token punctuation">))</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2514;ScrollConfiguration<span class="token punctuation">(</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:   &#x2514;AnimatedTheme<span class="token punctuation">(</span>duration: 200ms<span class="token punctuation">;</span> state: _AnimatedThemeState<span class="token punctuation">(</span><span class="token number">543295893</span><span class="token punctuation">;</span> ticker inactive<span class="token punctuation">;</span> ThemeDataTween<span class="token punctuation">(</span>ThemeData<span class="token punctuation">(</span>Brightness.light Color<span class="token punctuation">(</span>0xff2196f3<span class="token punctuation">)</span> etc<span class="token punctuation">..</span>.<span class="token punctuation">)</span> &#x2192; null<span class="token punctuation">))</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2514;Theme<span class="token punctuation">(</span>ThemeData<span class="token punctuation">(</span>Brightness.light Color<span class="token punctuation">(</span>0xff2196f3<span class="token punctuation">)</span> etc<span class="token punctuation">..</span>.<span class="token punctuation">))</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:     &#x2514;WidgetsApp<span class="token punctuation">(</span><span class="token punctuation">[</span>GlobalObjectKey _MaterialAppState<span class="token punctuation">(</span><span class="token number">1009803148</span><span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">;</span> state: _WidgetsAppState<span class="token punctuation">(</span><span class="token number">552902158</span><span class="token punctuation">))</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:      &#x2514;CheckedModeBanner<span class="token punctuation">(</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:       &#x2514;Banner<span class="token punctuation">(</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:        &#x2514;CustomPaint<span class="token punctuation">(</span>renderObject: RenderCustomPaint<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:         &#x2514;DefaultTextStyle<span class="token punctuation">(</span>inherit: <span class="token boolean">true</span><span class="token punctuation">;</span> color: Color<span class="token punctuation">(</span>0xd0ff0000<span class="token punctuation">)</span><span class="token punctuation">;</span> family: <span class="token string">&quot;monospace&quot;</span><span class="token punctuation">;</span> size: <span class="token number">48.0</span><span class="token punctuation">;</span> weight: <span class="token number">900</span><span class="token punctuation">;</span> decoration: double Color<span class="token punctuation">(</span>0xffffff00<span class="token punctuation">)</span> TextDecoration.underline<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:          &#x2514;MediaQuery<span class="token punctuation">(</span>MediaQueryData<span class="token punctuation">(</span>size: Size<span class="token punctuation">(</span><span class="token number">411.4</span>, <span class="token number">683.4</span><span class="token punctuation">)</span>, devicePixelRatio: <span class="token number">2.625</span>, textScaleFactor: <span class="token number">1.0</span>, padding: EdgeInsets<span class="token punctuation">(</span><span class="token number">0.0</span>, <span class="token number">24.0</span>, <span class="token number">0.0</span>, <span class="token number">0.0</span><span class="token punctuation">))</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:           &#x2514;LocaleQuery<span class="token punctuation">(</span>null<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:            &#x2514;Title<span class="token punctuation">(</span>color: Color<span class="token punctuation">(</span>0xff2196f3<span class="token punctuation">))</span>
<span class="token punctuation">..</span>. <span class="token comment">#&#x7701;&#x7565;&#x5269;&#x4F59;&#x5185;&#x5BB9;</span>
</code></pre>
<p>&#x8FD9;&#x662F;&#x4E00;&#x4E2A;&#x201C;&#x6241;&#x5E73;&#x5316;&#x201D;&#x7684;&#x6811;&#xFF0C;&#x663E;&#x793A;&#x4E86;&#x901A;&#x8FC7;&#x5404;&#x79CD;&#x6784;&#x5EFA;&#x51FD;&#x6570;&#x6295;&#x5F71;&#x7684;&#x6240;&#x6709;widget&#xFF08;&#x5982;&#x679C;&#x4F60;&#x5728;widget&#x6811;&#x7684;&#x6839;&#x4E2D;&#x8C03;&#x7528;<code>toStringDeepwidget</code>&#xFF0C;&#x8FD9;&#x662F;&#x4F60;&#x83B7;&#x5F97;&#x7684;&#x6811;&#xFF09;&#x3002; &#x4F60;&#x4F1A;&#x770B;&#x5230;&#x5F88;&#x591A;&#x5728;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x6E90;&#x4EE3;&#x7801;&#x4E2D;&#x6CA1;&#x6709;&#x51FA;&#x73B0;&#x7684;widget&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x4EEC;&#x662F;&#x88AB;&#x6846;&#x67B6;&#x4E2D;widget&#x7684;<code>build()</code>&#x51FD;&#x6570;&#x63D2;&#x5165;&#x7684;&#x3002;&#x4F8B;&#x5982;&#xFF0C;<a href="https://docs.flutter.io/flutter/material/InkFeature-class.html" target="_blank"><code>InkFeature</code></a>&#x662F;Material widget&#x7684;&#x4E00;&#x4E2A;&#x5B9E;&#x73B0;&#x7EC6;&#x8282; &#x3002;</p>
<p>&#x5F53;&#x6309;&#x94AE;&#x4ECE;&#x88AB;&#x6309;&#x4E0B;&#x53D8;&#x4E3A;&#x88AB;&#x91CA;&#x653E;&#x65F6;debugDumpApp()&#x88AB;&#x8C03;&#x7528;&#xFF0C;FlatButton&#x5BF9;&#x8C61;&#x540C;&#x65F6;&#x8C03;&#x7528;<code>setState()</code>&#xFF0C;&#x5E76;&#x5C06;&#x81EA;&#x5DF1;&#x6807;&#x8BB0;&#x4E3A;&quot;dirty&quot;&#x3002; &#x8FD9;&#x5C31;&#x662F;&#x4E3A;&#x4EC0;&#x4E48;&#x5982;&#x679C;&#x4F60;&#x770B;&#x8F6C;&#x50A8;&#xFF0C;&#x4F60;&#x4F1A;&#x770B;&#x5230;&#x7279;&#x5B9A;&#x7684;&#x5BF9;&#x8C61;&#x6807;&#x8BB0;&#x4E3A;&#x201C;dirty&#x201D;&#x3002;&#x60A8;&#x8FD8;&#x53EF;&#x4EE5;&#x67E5;&#x770B;&#x5DF2;&#x6CE8;&#x518C;&#x4E86;&#x54EA;&#x4E9B;&#x624B;&#x52BF;&#x76D1;&#x542C;&#x5668;; &#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x4E00;&#x4E2A;&#x5355;&#x4E00;&#x7684;GestureDetector&#x88AB;&#x5217;&#x51FA;&#xFF0C;&#x5E76;&#x4E14;&#x76D1;&#x542C;&#x201C;tap&#x201D;&#x624B;&#x52BF;&#xFF08;&#x201C;tap&#x201D;&#x662F;<code>TapGestureDetector</code>&#x7684;<code>toStringShort</code>&#x51FD;&#x6570;&#x8F93;&#x51FA;&#x7684;&#xFF09;</p>
<p>&#x5982;&#x679C;&#x60A8;&#x7F16;&#x5199;&#x81EA;&#x5DF1;&#x7684;widget&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8986;&#x76D6;<a href="https://docs.flutter.io/flutter/widgets/Widget/debugFillProperties.html" target="_blank"><code>debugFillProperties()</code></a>&#x6765;&#x6DFB;&#x52A0;&#x4FE1;&#x606F;&#x3002; &#x5C06;<a href="https://docs.flutter.io/flutter/foundation/DiagnosticsProperty-class.html" target="_blank">DiagnosticsProperty</a>&#x5BF9;&#x8C61;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x8C03;&#x7528;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;&#x3002; &#x8BE5;&#x51FD;&#x6570;&#x662F;&#x8BE5;<code>toString</code>&#x65B9;&#x6CD5;&#x7528;&#x6765;&#x586B;&#x5145;&#x5C0F;&#x90E8;&#x4EF6;&#x63CF;&#x8FF0;&#x4FE1;&#x606F;&#x7684;&#x3002;</p>
<h4 id="&#x6E32;&#x67D3;&#x6811;">&#x6E32;&#x67D3;&#x6811;</h4>
<p>&#x5982;&#x679C;&#x60A8;&#x5C1D;&#x8BD5;&#x8C03;&#x8BD5;&#x5E03;&#x5C40;&#x95EE;&#x9898;&#xFF0C;&#x90A3;&#x4E48;Widget&#x6811;&#x53EF;&#x80FD;&#x4E0D;&#x591F;&#x8BE6;&#x7EC6;&#x3002;&#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8C03;&#x7528;<code>debugDumpRenderTree()</code>&#x8F6C;&#x50A8;&#x6E32;&#x67D3;&#x6811;&#x3002; &#x6B63;&#x5982;<code>debugDumpApp()</code>&#xFF0C;&#x9664;&#x5E03;&#x5C40;&#x6216;&#x7ED8;&#x5236;&#x9636;&#x6BB5;&#x5916;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x968F;&#x65F6;&#x8C03;&#x7528;&#x6B64;&#x51FD;&#x6570;&#x3002;&#x4F5C;&#x4E3A;&#x4E00;&#x822C;&#x89C4;&#x5219;&#xFF0C;&#x4ECE;<a href="https://docs.flutter.io/flutter/scheduler/SchedulerBinding/addPersistentFrameCallback.html" target="_blank">frame &#x56DE;&#x8C03;</a> &#x6216;&#x4E8B;&#x4EF6;&#x5904;&#x7406;&#x5668;&#x4E2D;&#x8C03;&#x7528;&#x5B83;&#x662F;&#x6700;&#x4F73;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x3002;</p>
<p>&#x8981;&#x8C03;&#x7528;<code>debugDumpRenderTree()</code>&#xFF0C;&#x60A8;&#x9700;&#x8981;&#x6DFB;&#x52A0;<code>import&apos;package:flutter/rendering.dart&apos;;</code>&#x5230;&#x60A8;&#x7684;&#x6E90;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x4E0A;&#x9762;&#x8FD9;&#x4E2A;&#x5C0F;&#x4F8B;&#x5B50;&#x7684;&#x8F93;&#x51FA;&#x7ED3;&#x679C;&#x5982;&#x4E0B;&#x6240;&#x793A;&#xFF1A;</p>
<pre class="language-"><code class="lang-shell">I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>: RenderView
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2502; debug mode enabled - android
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2502; window size: Size<span class="token punctuation">(</span><span class="token number">1080.0</span>, <span class="token number">1794.0</span><span class="token punctuation">)</span> <span class="token punctuation">(</span>in physical pixels<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2502; device pixel ratio: <span class="token number">2.625</span> <span class="token punctuation">(</span>physical pixels per logical pixel<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2502; configuration: Size<span class="token punctuation">(</span><span class="token number">411.4</span>, <span class="token number">683.4</span><span class="token punctuation">)</span> at <span class="token number">2</span>.625x <span class="token punctuation">(</span>in logical pixels<span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2502;
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:  &#x2514;&#x2500;child: RenderCustomPaint
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502; creator: CustomPaint &#x2190; Banner &#x2190; CheckedModeBanner &#x2190;
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502;   WidgetsApp-<span class="token punctuation">[</span>GlobalObjectKey _MaterialAppState<span class="token punctuation">(</span><span class="token number">1009803148</span><span class="token punctuation">)</span><span class="token punctuation">]</span> &#x2190;
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502;   Theme &#x2190; AnimatedTheme &#x2190; ScrollConfiguration &#x2190; MaterialApp &#x2190;
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502;   <span class="token punctuation">[</span>root<span class="token punctuation">]</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502; parentData: <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502; constraints: BoxConstraints<span class="token punctuation">(</span>w<span class="token operator">=</span><span class="token number">411.4</span>, <span class="token assign-left variable">h</span><span class="token operator">=</span><span class="token number">683.4</span><span class="token punctuation">)</span>
I/flutter <span class="token punctuation">(</span> <span class="token number">6559</span><span class="token punctuation">)</span>:    &#x2502; size: Size<span class="token punctuation">(</span><span class="token number">411.4</span>, <span class="token number">683.4</span><span class="token punctuation">)</span>
<span class="token punctuation">..</span>. <span class="token comment"># &#x7701;&#x7565;</span>
</code></pre>
<p>&#x8FD9;&#x662F;&#x6839;<code>RenderObject</code>&#x5BF9;&#x8C61;&#x7684;<code>toStringDeep</code>&#x51FD;&#x6570;&#x7684;&#x8F93;&#x51FA;&#x3002;</p>
<p>&#x5F53;&#x8C03;&#x8BD5;&#x5E03;&#x5C40;&#x95EE;&#x9898;&#x65F6;&#xFF0C;&#x5173;&#x952E;&#x8981;&#x770B;&#x7684;&#x662F;<code>size</code>&#x548C;<code>constraints</code>&#x5B57;&#x6BB5;&#x3002;&#x7EA6;&#x675F;&#x6CBF;&#x7740;&#x6811;&#x5411;&#x4E0B;&#x4F20;&#x9012;&#xFF0C;&#x5C3A;&#x5BF8;&#x5411;&#x4E0A;&#x4F20;&#x9012;&#x3002;</p>
<p>&#x5982;&#x679C;&#x60A8;&#x7F16;&#x5199;&#x81EA;&#x5DF1;&#x7684;&#x6E32;&#x67D3;&#x5BF9;&#x8C61;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8986;&#x76D6;<a href="https://docs.flutter.io/flutter/rendering/Layer/debugFillProperties.html" target="_blank"><code>debugFillProperties()</code></a>&#x5C06;&#x4FE1;&#x606F;&#x6DFB;&#x52A0;&#x5230;&#x8F6C;&#x50A8;&#x3002; &#x5C06;<a href="https://docs.flutter.io/flutter/foundation/DiagnosticsProperty-class.html" target="_blank">DiagnosticsProperty</a>&#x5BF9;&#x8C61;&#x4F5C;&#x4E3A;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x8C03;&#x7528;&#x7236;&#x7C7B;&#x65B9;&#x6CD5;&#x3002;</p>
<h4 id="layer&#x6811;">Layer&#x6811;</h4>
<p>&#x8BFB;&#x8005;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E3A;&#x6E32;&#x67D3;&#x6811;&#x662F;&#x53EF;&#x4EE5;&#x5206;&#x5C42;&#x7684;&#xFF0C;&#x800C;&#x6700;&#x7EC8;&#x7ED8;&#x5236;&#x9700;&#x8981;&#x5C06;&#x4E0D;&#x540C;&#x7684;&#x5C42;&#x5408;&#x6210;&#x8D77;&#x6765;&#xFF0C;&#x800C;Layer&#x5219;&#x662F;&#x7ED8;&#x5236;&#x65F6;&#x9700;&#x8981;&#x5408;&#x6210;&#x7684;&#x5C42;&#xFF0C;&#x5982;&#x679C;&#x60A8;&#x5C1D;&#x8BD5;&#x8C03;&#x8BD5;&#x5408;&#x6210;&#x95EE;&#x9898;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<a href="https://docs.flutter.io/flutter/rendering/debugDumpLayerTree.html" target="_blank"><code>debugDumpLayerTree()</code></a>&#x3002;&#x5BF9;&#x4E8E;&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#xFF0C;&#x5B83;&#x4F1A;&#x8F93;&#x51FA;&#xFF1A;</p>
<pre class="language-"><code>I/flutter : TransformLayer
I/flutter :  &#x2502; creator: [root]
I/flutter :  &#x2502; offset: Offset(0.0, 0.0)
I/flutter :  &#x2502; transform:
I/flutter :  &#x2502;   [0] 3.5,0.0,0.0,0.0
I/flutter :  &#x2502;   [1] 0.0,3.5,0.0,0.0
I/flutter :  &#x2502;   [2] 0.0,0.0,1.0,0.0
I/flutter :  &#x2502;   [3] 0.0,0.0,0.0,1.0
I/flutter :  &#x2502;
I/flutter :  &#x251C;&#x2500;child 1: OffsetLayer
I/flutter :  &#x2502; &#x2502; creator: RepaintBoundary &#x2190; _FocusScope &#x2190; Semantics &#x2190; Focus-[GlobalObjectKey MaterialPageRoute(560156430)] &#x2190; _ModalScope-[GlobalKey 328026813] &#x2190; _OverlayEntry-[GlobalKey 388965355] &#x2190; Stack &#x2190; Overlay-[GlobalKey 625702218] &#x2190; Navigator-[GlobalObjectKey _MaterialAppState(859106034)] &#x2190; Title &#x2190; &#x22EF;
I/flutter :  &#x2502; &#x2502; offset: Offset(0.0, 0.0)
I/flutter :  &#x2502; &#x2502;
I/flutter :  &#x2502; &#x2514;&#x2500;child 1: PictureLayer
I/flutter :  &#x2502;
I/flutter :  &#x2514;&#x2500;child 2: PictureLayer
</code></pre><p>&#x8FD9;&#x662F;&#x6839;<code>Layer</code>&#x7684;<code>toStringDeep</code>&#x8F93;&#x51FA;&#x7684;&#x3002;</p>
<p>&#x6839;&#x90E8;&#x7684;&#x53D8;&#x6362;&#x662F;&#x5E94;&#x7528;&#x8BBE;&#x5907;&#x50CF;&#x7D20;&#x6BD4;&#x7684;&#x53D8;&#x6362;; &#x5728;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x6BCF;&#x4E2A;&#x903B;&#x8F91;&#x50CF;&#x7D20;&#x4EE3;&#x8868;3.5&#x4E2A;&#x8BBE;&#x5907;&#x50CF;&#x7D20;&#x3002;</p>
<p><code>RepaintBoundary</code> widget&#x5728;&#x6E32;&#x67D3;&#x6811;&#x7684;&#x5C42;&#x4E2D;&#x521B;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A;<code>RenderRepaintBoundary</code>&#x3002;&#x8FD9;&#x7528;&#x4E8E;&#x51CF;&#x5C11;&#x9700;&#x8981;&#x91CD;&#x7ED8;&#x7684;&#x9700;&#x6C42;&#x91CF;&#x3002;</p>
<h3 id="&#x8BED;&#x4E49;">&#x8BED;&#x4E49;</h3>
<p>&#x60A8;&#x8FD8;&#x53EF;&#x4EE5;&#x8C03;&#x7528;<a href="https://docs.flutter.io/flutter/rendering/debugDumpSemanticsTree.html" target="_blank"><code>debugDumpSemanticsTree()</code></a>&#x83B7;&#x53D6;&#x8BED;&#x4E49;&#x6811;&#xFF08;&#x5448;&#x73B0;&#x7ED9;&#x7CFB;&#x7EDF;&#x53EF;&#x8BBF;&#x95EE;&#x6027;API&#x7684;&#x6811;&#xFF09;&#x7684;&#x8F6C;&#x50A8;&#x3002; &#x8981;&#x4F7F;&#x7528;&#x6B64;&#x529F;&#x80FD;&#xFF0C;&#x5FC5;&#x987B;&#x9996;&#x5148;&#x542F;&#x7528;&#x8F85;&#x52A9;&#x529F;&#x80FD;&#xFF0C;&#x4F8B;&#x5982;&#x542F;&#x7528;&#x7CFB;&#x7EDF;&#x8F85;&#x52A9;&#x5DE5;&#x5177;&#x6216;<code>SemanticsDebugger</code> &#xFF08;&#x4E0B;&#x9762;&#x8BA8;&#x8BBA;&#xFF09;&#x3002;</p>
<p>&#x5BF9;&#x4E8E;&#x4E0A;&#x9762;&#x7684;&#x4F8B;&#x5B50;&#xFF0C;&#x5B83;&#x4F1A;&#x8F93;&#x51FA;:</p>
<pre class="language-"><code>I/flutter : SemanticsNode(0; Rect.fromLTRB(0.0, 0.0, 411.4, 683.4))
I/flutter :  &#x251C;SemanticsNode(1; Rect.fromLTRB(0.0, 0.0, 411.4, 683.4))
I/flutter :  &#x2502; &#x2514;SemanticsNode(2; Rect.fromLTRB(0.0, 0.0, 411.4, 683.4); canBeTapped)
I/flutter :  &#x2514;SemanticsNode(3; Rect.fromLTRB(0.0, 0.0, 411.4, 683.4))
I/flutter :    &#x2514;SemanticsNode(4; Rect.fromLTRB(0.0, 0.0, 82.0, 36.0); canBeTapped; &quot;Dump App&quot;)
</code></pre><h3 id="&#x8C03;&#x5EA6;">&#x8C03;&#x5EA6;</h3>
<p>&#x8981;&#x627E;&#x51FA;&#x76F8;&#x5BF9;&#x4E8E;&#x5E27;&#x7684;&#x5F00;&#x59CB;/&#x7ED3;&#x675F;&#x4E8B;&#x4EF6;&#x53D1;&#x751F;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x53EF;&#x4EE5;&#x5207;&#x6362;<a href="https://docs.flutter.io/flutter/scheduler/debugPrintBeginFrameBanner.html" target="_blank"><code>debugPrintBeginFrameBanner</code></a>&#x548C;<a href="https://docs.flutter.io/flutter/scheduler/debugPrintEndFrameBanner.html" target="_blank"><code>debugPrintEndFrameBanner</code></a>&#x5E03;&#x5C14;&#x503C;&#x4EE5;&#x5C06;&#x5E27;&#x7684;&#x5F00;&#x59CB;&#x548C;&#x7ED3;&#x675F;&#x6253;&#x5370;&#x5230;&#x63A7;&#x5236;&#x53F0;&#x3002;</p>
<p>&#x4F8B;&#x5982;:</p>
<pre class="language-"><code>I/flutter : &#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584; Frame 12         30s 437.086ms &#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584;&#x2584;
I/flutter : Debug print: Am I performing this work more than once per frame?
I/flutter : Debug print: Am I performing this work more than once per frame?
I/flutter : &#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;&#x2580;
</code></pre><p><a href="https://docs.flutter.io/flutter/scheduler/debugPrintScheduleFrameStacks.html" target="_blank"><code>debugPrintScheduleFrameStacks</code></a>&#x8FD8;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x6253;&#x5370;&#x5BFC;&#x81F4;&#x5F53;&#x524D;&#x5E27;&#x88AB;&#x8C03;&#x5EA6;&#x7684;&#x8C03;&#x7528;&#x5806;&#x6808;&#x3002;</p>
<h3 id="&#x53EF;&#x89C6;&#x5316;&#x8C03;&#x8BD5;">&#x53EF;&#x89C6;&#x5316;&#x8C03;&#x8BD5;</h3>
<p>&#x60A8;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E;<code>debugPaintSizeEnabled</code>&#x4E3A;<code>true</code>&#x4EE5;&#x53EF;&#x89C6;&#x65B9;&#x5F0F;&#x8C03;&#x8BD5;&#x5E03;&#x5C40;&#x95EE;&#x9898;&#x3002; &#x8FD9;&#x662F;&#x6765;&#x81EA;<code>rendering</code>&#x5E93;&#x7684;&#x5E03;&#x5C14;&#x503C;&#x3002;&#x5B83;&#x53EF;&#x4EE5;&#x5728;&#x4EFB;&#x4F55;&#x65F6;&#x5019;&#x542F;&#x7528;&#xFF0C;&#x5E76;&#x5728;&#x4E3A;true&#x65F6;&#x5F71;&#x54CD;&#x7ED8;&#x5236;&#x3002; &#x8BBE;&#x7F6E;&#x5B83;&#x7684;&#x6700;&#x7B80;&#x5355;&#x65B9;&#x6CD5;&#x662F;&#x5728;<code>void main()</code>&#x7684;&#x9876;&#x90E8;&#x8BBE;&#x7F6E;&#x3002;</p>
<p>&#x5F53;&#x5B83;&#x88AB;&#x542F;&#x7528;&#x65F6;&#xFF0C;&#x6240;&#x6709;&#x7684;&#x76D2;&#x5B50;&#x90FD;&#x4F1A;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x660E;&#x4EAE;&#x7684;&#x6DF1;&#x9752;&#x8272;&#x8FB9;&#x6846;&#xFF0C;padding&#xFF08;&#x6765;&#x81EA;widget&#x5982;Padding&#xFF09;&#x663E;&#x793A;&#x4E3A;&#x6D45;&#x84DD;&#x8272;&#xFF0C;&#x5B50;widget&#x5468;&#x56F4;&#x6709;&#x4E00;&#x4E2A;&#x6DF1;&#x84DD;&#x8272;&#x6846;&#xFF0C; &#x5BF9;&#x9F50;&#x65B9;&#x5F0F;&#xFF08;&#x6765;&#x81EA;widget&#x5982;Center&#x548C;Align&#xFF09;&#x663E;&#x793A;&#x4E3A;&#x9EC4;&#x8272;&#x7BAD;&#x5934;. &#x7A7A;&#x767D;&#xFF08;&#x5982;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x5B50;&#x8282;&#x70B9;&#x7684;Container&#xFF09;&#x4EE5;&#x7070;&#x8272;&#x663E;&#x793A;&#x3002;</p>
<p><a href="https://docs.flutter.io/flutter/rendering/debugPaintBaselinesEnabled.html" target="_blank"><code>debugPaintBaselinesEnabled</code></a>&#x505A;&#x4E86;&#x7C7B;&#x4F3C;&#x7684;&#x4E8B;&#x60C5;&#xFF0C;&#x4F46;&#x5BF9;&#x4E8E;&#x5177;&#x6709;&#x57FA;&#x7EBF;&#x7684;&#x5BF9;&#x8C61;&#xFF0C;&#x6587;&#x5B57;&#x57FA;&#x7EBF;&#x4EE5;&#x7EFF;&#x8272;&#x663E;&#x793A;&#xFF0C;&#x8868;&#x610F;(ideographic)&#x57FA;&#x7EBF;&#x4EE5;&#x6A59;&#x8272;&#x663E;&#x793A;&#x3002;</p>
<p><a href="https://docs.flutter.io/flutter/rendering/debugPaintPointersEnabled.html" target="_blank"><code>debugPaintPointersEnabled</code></a>&#x6807;&#x5FD7;&#x6253;&#x5F00;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x6A21;&#x5F0F;&#xFF0C;&#x4EFB;&#x4F55;&#x6B63;&#x5728;&#x70B9;&#x51FB;&#x7684;&#x5BF9;&#x8C61;&#x90FD;&#x4F1A;&#x4EE5;&#x6DF1;&#x9752;&#x8272;&#x7A81;&#x51FA;&#x663E;&#x793A;&#x3002; &#x8FD9;&#x53EF;&#x4EE5;&#x5E2E;&#x52A9;&#x60A8;&#x786E;&#x5B9A;&#x67D0;&#x4E2A;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x4EE5;&#x67D0;&#x79CD;&#x4E0D;&#x6B63;&#x786E;&#x7684;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;hit&#x6D4B;&#x8BD5;&#xFF08;Flutter&#x68C0;&#x6D4B;&#x70B9;&#x51FB;&#x7684;&#x4F4D;&#x7F6E;&#x662F;&#x5426;&#x6709;&#x80FD;&#x54CD;&#x5E94;&#x7528;&#x6237;&#x64CD;&#x4F5C;&#x7684;widget&#xFF09;,&#x4F8B;&#x5982;&#xFF0C;&#x5982;&#x679C;&#x5B83;&#x5B9E;&#x9645;&#x4E0A;&#x8D85;&#x51FA;&#x4E86;&#x5176;&#x7236;&#x9879;&#x7684;&#x8303;&#x56F4;&#xFF0C;&#x9996;&#x5148;&#x4E0D;&#x4F1A;&#x8003;&#x8651;&#x901A;&#x8FC7;hit&#x6D4B;&#x8BD5;&#x3002;</p>
<p>&#x5982;&#x679C;&#x60A8;&#x5C1D;&#x8BD5;&#x8C03;&#x8BD5;&#x5408;&#x6210;&#x56FE;&#x5C42;&#xFF0C;&#x4F8B;&#x5982;&#x4EE5;&#x786E;&#x5B9A;&#x662F;&#x5426;&#x4EE5;&#x53CA;&#x5728;&#x4F55;&#x5904;&#x6DFB;&#x52A0;<code>RepaintBoundary</code> widget&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<a href="https://docs.flutter.io/flutter/rendering/debugPaintLayerBordersEnabled.html" target="_blank"><code>debugPaintLayerBordersEnabled</code></a> &#x6807;&#x5FD7;&#xFF0C; &#x8BE5;&#x6807;&#x5FD7;&#x7528;&#x6A59;&#x8272;&#x6216;&#x8F6E;&#x5ED3;&#x7EBF;&#x6807;&#x51FA;&#x6BCF;&#x4E2A;&#x5C42;&#x7684;&#x8FB9;&#x754C;&#xFF0C;&#x6216;&#x8005;&#x4F7F;&#x7528;<a href="https://docs.flutter.io/flutter/rendering/debugRepaintRainbowEnabled.html" target="_blank"><code>debugRepaintRainbowEnabled</code></a>&#x6807;&#x5FD7;&#xFF0C; &#x53EA;&#x8981;&#x4ED6;&#x4EEC;&#x91CD;&#x7ED8;&#x65F6;&#xFF0C;&#x8FD9;&#x4F1A;&#x4F7F;&#x8BE5;&#x5C42;&#x88AB;&#x4E00;&#x7EC4;&#x65CB;&#x8F6C;&#x8272;&#x6240;&#x8986;&#x76D6;&#x3002;</p>
<p>&#x6240;&#x6709;&#x8FD9;&#x4E9B;&#x6807;&#x5FD7;&#x53EA;&#x80FD;&#x5728;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x4E0B;&#x5DE5;&#x4F5C;&#x3002;&#x901A;&#x5E38;&#xFF0C;Flutter&#x6846;&#x67B6;&#x4E2D;&#x4EE5;&#x201C;<code>debug...</code>&#x201D; &#x5F00;&#x5934;&#x7684;&#x4EFB;&#x4F55;&#x5185;&#x5BB9;&#x90FD;&#x53EA;&#x80FD;&#x5728;&#x8C03;&#x8BD5;&#x6A21;&#x5F0F;&#x4E0B;&#x5DE5;&#x4F5C;&#x3002;</p>
<h3 id="&#x8C03;&#x8BD5;&#x52A8;&#x753B;">&#x8C03;&#x8BD5;&#x52A8;&#x753B;</h3>
<p>&#x8C03;&#x8BD5;&#x52A8;&#x753B;&#x6700;&#x7B80;&#x5355;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x51CF;&#x6162;&#x5B83;&#x4EEC;&#x7684;&#x901F;&#x5EA6;&#x3002;&#x4E3A;&#x6B64;&#xFF0C;&#x8BF7;&#x5C06;<a href="https://docs.flutter.io/flutter/scheduler/timeDilation.html" target="_blank"><code>timeDilation</code></a>&#x53D8;&#x91CF;&#xFF08;&#x5728;scheduler&#x5E93;&#x4E2D;&#xFF09;&#x8BBE;&#x7F6E;&#x4E3A;&#x5927;&#x4E8E;1.0&#x7684;&#x6570;&#x5B57;&#xFF0C;&#x4F8B;&#x5982;50.0&#x3002; &#x6700;&#x597D;&#x5728;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x542F;&#x52A8;&#x65F6;&#x53EA;&#x8BBE;&#x7F6E;&#x4E00;&#x6B21;&#x3002;&#x5982;&#x679C;&#x60A8;&#x5728;&#x8FD0;&#x884C;&#x4E2D;&#x66F4;&#x6539;&#x5B83;&#xFF0C;&#x5C24;&#x5176;&#x662F;&#x5728;&#x52A8;&#x753B;&#x8FD0;&#x884C;&#x65F6;&#x5C06;&#x5176;&#x503C;&#x6539;&#x5C0F;&#xFF0C;&#x5219;&#x5728;&#x89C2;&#x5BDF;&#x65F6;&#x53EF;&#x80FD;&#x4F1A;&#x51FA;&#x73B0;&#x5012;&#x9000;&#xFF0C;&#x8FD9;&#x53EF;&#x80FD;&#x4F1A;&#x5BFC;&#x81F4;&#x65AD;&#x8A00;&#x547D;&#x4E2D;&#xFF0C;&#x5E76;&#x4E14;&#x8FD9;&#x901A;&#x5E38;&#x4F1A;&#x5E72;&#x6270;&#x6211;&#x4EEC;&#x7684;&#x5F00;&#x53D1;&#x5DE5;&#x4F5C;&#x3002;</p>
<h3 id="&#x8C03;&#x8BD5;&#x6027;&#x80FD;&#x95EE;&#x9898;">&#x8C03;&#x8BD5;&#x6027;&#x80FD;&#x95EE;&#x9898;</h3>
<p>&#x8981;&#x4E86;&#x89E3;&#x60A8;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x5BFC;&#x81F4;&#x91CD;&#x65B0;&#x5E03;&#x5C40;&#x6216;&#x91CD;&#x65B0;&#x7ED8;&#x5236;&#x7684;&#x539F;&#x56E0;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x5206;&#x522B;&#x8BBE;&#x7F6E;<a href="https://docs.flutter.io/flutter/rendering/debugPrintMarkNeedsLayoutStacks.html" target="_blank"><code>debugPrintMarkNeedsLayoutStacks</code></a>&#x548C; <a href="https://docs.flutter.io/flutter/rendering/debugPrintMarkNeedsPaintStacks.html" target="_blank"><code>debugPrintMarkNeedsPaintStacks</code></a>&#x6807;&#x5FD7;&#x3002; &#x6BCF;&#x5F53;&#x6E32;&#x67D3;&#x76D2;&#x88AB;&#x8981;&#x6C42;&#x91CD;&#x65B0;&#x5E03;&#x5C40;&#x548C;&#x91CD;&#x65B0;&#x7ED8;&#x5236;&#x65F6;&#xFF0C;&#x8FD9;&#x4E9B;&#x90FD;&#x4F1A;&#x5C06;&#x5806;&#x6808;&#x8DDF;&#x8E2A;&#x8BB0;&#x5F55;&#x5230;&#x63A7;&#x5236;&#x53F0;&#x3002;&#x5982;&#x679C;&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x5BF9;&#x60A8;&#x6709;&#x7528;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>services</code>&#x5E93;&#x4E2D;&#x7684;<code>debugPrintStack()</code>&#x65B9;&#x6CD5;&#x6309;&#x9700;&#x6253;&#x5370;&#x5806;&#x6808;&#x75D5;&#x8FF9;&#x3002;</p>
<h3 id="&#x7EDF;&#x8BA1;&#x5E94;&#x7528;&#x542F;&#x52A8;&#x65F6;&#x95F4;">&#x7EDF;&#x8BA1;&#x5E94;&#x7528;&#x542F;&#x52A8;&#x65F6;&#x95F4;</h3>
<p>&#x8981;&#x6536;&#x96C6;&#x6709;&#x5173;Flutter&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x542F;&#x52A8;&#x6240;&#x9700;&#x65F6;&#x95F4;&#x7684;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x8FD0;&#x884C;<code>flutter run</code>&#x65F6;&#x4F7F;&#x7528;<code>trace-startup</code>&#x548C;<code>profile</code>&#x9009;&#x9879;&#x3002;</p>
<pre class="language-"><code class="lang-shell">$ flutter run --trace-startup --profile
</code></pre>
<p>&#x8DDF;&#x8E2A;&#x8F93;&#x51FA;&#x4FDD;&#x5B58;&#x4E3A;<code>start_up_info.json</code>&#xFF0C;&#x5728;Flutter&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;&#x5728;build&#x76EE;&#x5F55;&#x4E0B;&#x3002;&#x8F93;&#x51FA;&#x5217;&#x51FA;&#x4E86;&#x4ECE;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x542F;&#x52A8;&#x5230;&#x8FD9;&#x4E9B;&#x8DDF;&#x8E2A;&#x4E8B;&#x4EF6;&#xFF08;&#x4EE5;&#x5FAE;&#x79D2;&#x6355;&#x83B7;&#xFF09;&#x6240;&#x7528;&#x7684;&#x65F6;&#x95F4;&#xFF1A;</p>
<ul>
<li>&#x8FDB;&#x5165;Flutter&#x5F15;&#x64CE;&#x65F6;.</li>
<li>&#x5C55;&#x793A;&#x5E94;&#x7528;&#x7B2C;&#x4E00;&#x5E27;&#x65F6;.</li>
<li>&#x521D;&#x59CB;&#x5316;Flutter&#x6846;&#x67B6;&#x65F6;.</li>
<li>&#x5B8C;&#x6210;Flutter&#x6846;&#x67B6;&#x521D;&#x59CB;&#x5316;&#x65F6;.</li>
</ul>
<p>&#x5982; :</p>
<pre class="language-"><code class="lang-json"><span class="token punctuation">{</span>
  <span class="token property">&quot;engineEnterTimestampMicros&quot;</span><span class="token operator">:</span> <span class="token number">96025565262</span><span class="token punctuation">,</span>
  <span class="token property">&quot;timeToFirstFrameMicros&quot;</span><span class="token operator">:</span> <span class="token number">2171978</span><span class="token punctuation">,</span>
  <span class="token property">&quot;timeToFrameworkInitMicros&quot;</span><span class="token operator">:</span> <span class="token number">514585</span><span class="token punctuation">,</span>
  <span class="token property">&quot;timeAfterFrameworkInitMicros&quot;</span><span class="token operator">:</span> <span class="token number">1657393</span>
<span class="token punctuation">}</span>
</code></pre>
<h3 id="&#x8DDF;&#x8E2A;dart&#x4EE3;&#x7801;&#x6027;&#x80FD;">&#x8DDF;&#x8E2A;Dart&#x4EE3;&#x7801;&#x6027;&#x80FD;</h3>
<p>&#x8981;&#x6267;&#x884C;&#x81EA;&#x5B9A;&#x4E49;&#x6027;&#x80FD;&#x8DDF;&#x8E2A;&#x548C;&#x6D4B;&#x91CF;Dart&#x4EFB;&#x610F;&#x4EE3;&#x7801;&#x6BB5;&#x7684;wall/CPU&#x65F6;&#x95F4;&#xFF08;&#x7C7B;&#x4F3C;&#x4E8E;&#x5728;Android&#x4E0A;&#x4F7F;&#x7528;<a href="https://developer.android.com/studio/profile/systrace.html" target="_blank">systrace</a>&#xFF09;&#x3002; &#x4F7F;&#x7528;<code>dart:developer</code>&#x7684;<a href="https://api.dartlang.org/stable/dart-developer/Timeline-class.html" target="_blank">Timeline</a>&#x5DE5;&#x5177;&#x6765;&#x5305;&#x542B;&#x4F60;&#x60F3;&#x6D4B;&#x8BD5;&#x7684;&#x4EE3;&#x7801;&#x5757;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre class="language-"><code class="lang-dart">Timeline<span class="token punctuation">.</span><span class="token function">startSync</span><span class="token punctuation">(</span><span class="token string">&apos;interesting function&apos;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// iWonderHowLongThisTakes();</span>
Timeline<span class="token punctuation">.</span><span class="token function">finishSync</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<p>&#x7136;&#x540E;&#x6253;&#x5F00;&#x4F60;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;Observatory timeline&#x9875;&#x9762;&#xFF0C;&#x5728;&#x201C;Recorded Streams&#x201D;&#x4E2D;&#x9009;&#x62E9;&#x2018;Dart&#x2019;&#x590D;&#x9009;&#x6846;&#xFF0C;&#x5E76;&#x6267;&#x884C;&#x4F60;&#x60F3;&#x6D4B;&#x91CF;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
<p>&#x5237;&#x65B0;&#x9875;&#x9762;&#x5C06;&#x5728;Chrome&#x7684;<a href="https://www.chromium.org/developers/how-tos/trace-event-profiling-tool" target="_blank">&#x8DDF;&#x8E2A;&#x5DE5;&#x5177;</a>&#x4E2D;&#x663E;&#x793A;&#x5E94;&#x7528;&#x6309;&#x65F6;&#x95F4;&#x987A;&#x5E8F;&#x6392;&#x5217;&#x7684;timeline&#x8BB0;&#x5F55;&#x3002;</p>
<p>&#x8BF7;&#x786E;&#x4FDD;&#x8FD0;&#x884C;<code>flutter run</code>&#x65F6;&#x5E26;&#x6709;<code>--profile</code>&#x6807;&#x5FD7;&#xFF0C;&#x4EE5;&#x786E;&#x4FDD;&#x8FD0;&#x884C;&#x65F6;&#x6027;&#x80FD;&#x7279;&#x5F81;&#x4E0E;&#x60A8;&#x7684;&#x6700;&#x7EC8;&#x4EA7;&#x54C1;&#x5DEE;&#x5F02;&#x6700;&#x5C0F;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="flutter_assets_mgr.html" class="navigation navigation-prev " aria-label="Previous page: 2.4：资源管理">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="thread_model_and_error_report.html" class="navigation navigation-next " aria-label="Next page: 2.6：Dart线程模型及异常捕获">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.5：调试Flutter APP","level":"2.2.5","depth":2,"next":{"title":"2.6：Dart线程模型及异常捕获","level":"2.2.6","depth":2,"path":"chapter2/thread_model_and_error_report.md","ref":"chapter2/thread_model_and_error_report.md","articles":[]},"previous":{"title":"2.4：资源管理","level":"2.2.4","depth":2,"path":"chapter2/flutter_assets_mgr.md","ref":"chapter2/flutter_assets_mgr.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","search-pro","ace","splitter","prism","donate","-highlight"],"root":"docs","styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"prism":{"lang":{"shell":"bash"}},"ace":{},"splitter":{},"search-pro":{"cutWordLib":"nodejieba","defineWord":["Gitbook Use"]},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"","alipayText":"支付宝打赏","button":"赏","title":"","wechat":"https://pcdn.flutterchina.club/imgs/pay.jpeg","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":2},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"wendux 824783146@qq.com","bookRoot":"https://book.flutterchina.club/","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"《Flutter实战》","language":"zh-hans","links":{"sharing":{"all":null,"facebook":null,"google":null,"twitter":null,"weibo":null},"sidebar":{"<div><img height=20 style='position:relative; top:5px; padding-right:5px ' src='https://cdn.jsdelivr.net/gh/flutterchina/website@1.0/images/favicon.png'/> Flutter中文网</div>":"https://flutterchina.club"}},"gitbook":"*","description":"记录Gitbook的配置和一些插件的使用"},"file":{"path":"chapter2/flutter_app_debug.md","mtime":"2019-10-15T02:27:20.288Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-05T06:01:05.405Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>



    <script src="https://pcdn.flutterchina.club/gitbook/gitbook.js"></script>
    <script src="https://pcdn.flutterchina.club/gitbook/theme.js"></script>
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-ace/ace/ace.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-ace/ace.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="https://pcdn.flutterchina.club/gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    


<script src="https://pcdn.flutterchina.club/gitbook/pub.js"></script>
</body>

</html>

